package fmi.chesstern.game;

public class Move {
	private final BoardField from;
	private final BoardField to;
	
	public Move(BoardField from, BoardField to) {
		this.from = from;
		this.to = to;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((from == null) ? 0 : from.hashCode());
		result = prime * result + ((to == null) ? 0 : to.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Move)) {
			return false;
		}
		
		Move other = (Move) obj;

		return from.equals(other.from) && to.equals(other.to); 
	}

	public BoardField getFrom() {
		return from;
	}

	public BoardField getTo() {
		return to;
	}
}
